<div class="dcjq-vertical-mega-menu">
	<ul id="mega-1" class="menu">
	<?php $loai_sanpham = get_terms('loai-san-pham', 'hide_empty=1'); ?>
      <h3> Danh mục sản phẩm</h3>
    <?php foreach( $loai_sanpham as $sanpham ) : ?>
		  <li>
				<a href="<?php echo get_term_link( $sanpham->slug, 'loai-san-pham' ); ?>">
				  <?php echo $sanpham->name; ?>
				</a>
					<?php $nha_sanxuat= get_terms('nha-san-xuat', 'hide_empty=1'); ?>
					<ul>
					<?php foreach( $nha_sanxuat as $sanxuat ) : ?>
					<?php
						$args = array( 'post_type' => 'san-pham','loai-san-pham'=>$sanpham->slug,"nha-san-xuat"=>$sanxuat->slug);
						$loop = new WP_Query( $args );
					?>
					<?php
						if($loop->post_count>0){
							echo '<li><a href="'.get_term_link( $sanxuat->slug, 'nha-san-xuat' ).'">'.$sanxuat->name.'</a></li>';
						}
					?>
				<?php endforeach ?>
				</ul>
		  </li>
	<?php endforeach ?>
  </ul>
</div>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Main Sidebar") ) : ?>
<h2>Main sidebar</h2>
<p>Bạn chưa gọi widget nào</p>
<?php endif;?>
